<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模板引擎</title>
    <!--引入模板-->
    <script src="javascripts/template-web.js"></script>
</head>
<body>
    <div id="container"></div>
    <!--准备模板-->
    <script id="tp1" type="text/html">
        <h1>{{username}} {{age}}</h1>
    </script>

    <!--告诉拼接方法-->
    <script type="text/javascript">
        // 3.告诉模板引擎将哪个数据和哪个模板进行拼接
        // pos1:模板id pos2:对象类
        var html = template('tp1', {username:'zhangsan', age:30})
        cont = document.getElementById('container')
        cont.innerHTML = html
    </script>

</body>
</html>